// 圆形图像
import QtQuick 2.0
import QtGraphicalEffects 1.0

Rectangle {
    id: ri

    clip: true
    color: "transparent"
    radius: height/2
    border.color: "black"
    border.width: 0

    property string source

    Image {
        anchors.fill: parent
        sourceSize: Qt.size(parent.width, parent.height)
        smooth: true
        visible: true
        fillMode: Image.PreserveAspectCrop
        layer.enabled: true
        layer.effect: OpacityMask {
            maskSource: mask
        }

        source: ri.source
    }

    Rectangle {
        id: mask
        anchors.fill: parent
        width: parent.width
        height: parent.height
        radius: height/2
        visible: false
    }
}
